home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
ezacce
/
players.bas
< prev
next >
Wrap
BASIC Source File
|
1995-03-03
|
8KB
|
272 lines
global dbf___Players as database
global Playersdbf___ as table
global eof_Players as integer
global Playerslastindex as string
global PlayersDBFOPEN as INTEGER
global LName as string * 15
global FName as string * 15
global Initial as string * 1
global Birthdate as string * 8
global SeqNum as string * 4
global LNamekeycount as integer
global LNameLENGTHOFLASTKEY as integer
global SeqNumkeycount as integer
global SeqNumLENGTHOFLASTKEY as integer
sub open_Players ()
set dbf___Players = opendatabase("c:\ez\sample\LITTLELG.mdb", false, false, "")
set Playersdbf___ = dbf___Players.opentable("Players")
end sub
sub RP_Players ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
IF PlayersDBF___.EOF AND PlayersDBF___.BOF THEN
EOF_Players=TRUE
INIT_Players
ELSE
if Playerslastindex <> "PHYSICAL" then
Playersdbf___.index = ""
Playerslastindex = "PHYSICAL"
Playersdbf___.movefirst
else
Playersdbf___.movenext
end if
if Playersdbf___.eof then
eof_Players = true
INIT_Players
Playerslastindex = ""
else
tomem_Players
eof_Players = false
end if
end if
end sub
sub re_LName ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
if Playerslastindex <> "LName" then
Playersdbf___.index = "LName"
Playerslastindex = "LName"
LNamekeycount= 3
LNameLENGTHOFLASTKEY = LEN(RTRIM$(Initial))
if Initial = space$(len(Initial)) OR ASC(Initial) = 0 then
LNamekeycount = 2
LNameLENGTHOFLASTKEY = LEN(RTRIM$(FName))
END IF
if FName = space$(len(FName)) OR ASC(FName) = 0 then
LNamekeycount = 1
LNameLENGTHOFLASTKEY = LEN(RTRIM$(LName))
END IF
if LName = space$(len(LName)) OR ASC(LName) = 0 then
LNamekeycount = 0
END IF
eof_Players = false
Playersdbf___.seek ">=", LName, FName, Initial
if Playersdbf___.nomatch then eof_Players = true
else
Playersdbf___.movenext
if Playersdbf___.eof then eof_Players = true
end if
if not eof_Players then
If LNamekeycount > 0 then
if LNamekeycount > 1 then
if LName <> Playersdbf___("LName") then eof_Players = true
else
if LEFT$(LName,LNameLENGTHOFLASTKEY) <> LEFT$(Playersdbf___("LName"),LNameLENGTHOFLASTKEY) then eof_Players = true
end if
end if
end if
if not eof_Players then
If LNamekeycount > 1 then
if LNamekeycount > 2 then
if FName <> Playersdbf___("FName") then eof_Players = true
else
if LEFT$(FName,LNameLENGTHOFLASTKEY) <> LEFT$(Playersdbf___("FName"),LNameLENGTHOFLASTKEY) then eof_Players = true
end if
end if
end if
if not eof_Players then
If LNamekeycount > 2 then
if LNamekeycount > 3 then
if Initial <> Playersdbf___("Initial") then eof_Players = true
else
if LEFT$(Initial,LNameLENGTHOFLASTKEY) <> LEFT$(Playersdbf___("Initial"),LNameLENGTHOFLASTKEY) then eof_Players = true
end if
end if
end if
if eof_Players then
Playerslastindex = ""
else
tomem_Players
eof_Players = false
end if
end sub
sub re_SeqNum ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
if Playerslastindex <> "SeqNum" then
Playersdbf___.index = "SeqNum"
Playerslastindex = "SeqNum"
SeqNumkeycount= 1
SeqNumLENGTHOFLASTKEY = LEN(RTRIM$(SeqNum))
if SeqNum = space$(len(SeqNum)) OR ASC(SeqNum) = 0 then
SeqNumkeycount = 0
END IF
eof_Players = false
Playersdbf___.seek ">=", SeqNum
if Playersdbf___.nomatch then eof_Players = true
else
Playersdbf___.movenext
if Playersdbf___.eof then eof_Players = true
end if
if not eof_Players then
If SeqNumkeycount > 0 then
if SeqNumkeycount > 1 then
if SeqNum <> Playersdbf___("SeqNum") then eof_Players = true
else
if LEFT$(SeqNum,SeqNumLENGTHOFLASTKEY) <> LEFT$(Playersdbf___("SeqNum"),SeqNumLENGTHOFLASTKEY) then eof_Players = true
end if
end if
end if
if eof_Players then
Playerslastindex = ""
else
tomem_Players
eof_Players = false
end if
end sub
sub rK_LName ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
if Playerslastindex <> "LName" then
Playersdbf___.index = "LName"
Playerslastindex = ""
END IF
Playersdbf___.seek "=", LName, FName, Initial
if Playersdbf___.nomatch then
eof_Players = true
Playerslastindex = ""
else
tomem_Players
eof_Players = false
end if
end sub
sub rK_SeqNum ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
if Playerslastindex <> "SeqNum" then
Playersdbf___.index = "SeqNum"
Playerslastindex = ""
END IF
Playersdbf___.seek "=", SeqNum
if Playersdbf___.nomatch then
eof_Players = true
Playerslastindex = ""
else
tomem_Players
eof_Players = false
end if
end sub
sub tomem_Players ()
IF ISNULL(Playersdbf___("LName")) THEN
LName = SPACE$(LEN(LName))
ELSE
LName = Playersdbf___("LName")
ENDIF
IF ISNULL(Playersdbf___("FName")) THEN
FName = SPACE$(LEN(FName))
ELSE
FName = Playersdbf___("FName")
ENDIF
IF ISNULL(Playersdbf___("Initial")) THEN
Initial = SPACE$(LEN(Initial))
ELSE
Initial = Playersdbf___("Initial")
ENDIF
IF ISNULL(Playersdbf___("Birthdate")) THEN
Birthdate = " "
ELSE
Birthdate = Playersdbf___("Birthdate")
ENDIF
IF ISNULL(Playersdbf___("SeqNum")) THEN
SeqNum = SPACE$(LEN(SeqNum))
ELSE
SeqNum = Playersdbf___("SeqNum")
ENDIF
end sub
sub FROMMEM_Players ()
Playersdbf___("LName") = LName
Playersdbf___("FName") = FName
Playersdbf___("Initial") = Initial
Playersdbf___("Birthdate") = Birthdate
Playersdbf___("SeqNum") = SeqNum
end sub
sub INIT_Players ()
LName = ""
FName = ""
Initial = ""
Birthdate = " "
SeqNum = ""
end sub
sub close_Players ()
If Playersdbfopen then
Playersdbf___.close
end if
end sub
sub update_Players ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
Playersdbf___.edit
frommem_Players
Playersdbf___.update
end sub
sub write_Players ()
IF NOT PlayersDBFOPEN THEN
OPEN_Players
PlayersDBFOPEN = TRUE
END IF
Playersdbf___.addnew
frommem_Players
Playersdbf___.update
end sub
Sub delete_Players ()
Playersdbf___.delete
end sub